package com.yong.activemq.spring;

import lombok.SneakyThrows;
import org.springframework.stereotype.Component;

import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

@Component
public class MyMessageListener implements MessageListener {
    @SneakyThrows
    @Override
    public void onMessage(Message message) {
        if (message != null&&message instanceof TextMessage){
            TextMessage textMessage = (TextMessage)message;
            System.out.println("监听获取推送的内容"+textMessage.getText());
        }
    }
}
